package com.hqj.demo.service;

import com.hqj.demo.dao.MemberDao;
import com.hqj.demo.entity.Teacher;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

public class MemberServiceI2 implements MemberService {
    @Autowired
    private MemberDao md;

    @Override
    public List<Teacher> findTeacher(String param) {

        List<Teacher> list = new ArrayList<>();
        try {
            double height = Double.parseDouble(param);
            List<Teacher> allList = md.findMember();
            for (Teacher t : allList) {
                if (t.getHeight() >= height) {
                    list.add(t);
                }
            }
        }catch (Exception e){
            System.out.println("身高字符串无法转换为小数？"+e.getMessage());
        }

        return list;
    }
}
